home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / citycon.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  13KB  |  353 lines

  1. /***************************************************************************
  2.  
  3.  
  4. ***************************************************************************/
  5.  
  6. #include "driver.h"
  7. #include "vidhrdw/generic.h"
  8.  
  9.  
  10. extern unsigned char *citycon_scroll;
  11. extern unsigned char *citycon_charlookup;
  12. WRITE_HANDLER( citycon_charlookup_w );
  13. WRITE_HANDLER( citycon_background_w );
  14. READ_HANDLER( citycon_in_r );
  15.  
  16. void citycon_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  17. int  citycon_vh_start(void);
  18. void citycon_vh_stop(void);
  19.  
  20.  
  21.  
  22. static struct MemoryReadAddress readmem[] =
  23. {
  24.     { 0x0000, 0x1fff, MRA_RAM },
  25.     { 0x3000, 0x3000, citycon_in_r },    /* player 1 & 2 inputs multiplexed */
  26.     { 0x3001, 0x3001, input_port_2_r },
  27.     { 0x3002, 0x3002, input_port_3_r },
  28.     { 0x3007, 0x3007, watchdog_reset_r },    /* ? */
  29.     { 0x4000, 0xffff, MRA_ROM },
  30.     { -1 }  /* end of table */
  31. };
  32.  
  33. static struct MemoryWriteAddress writemem[] =
  34. {
  35.     { 0x0000, 0x0fff, MWA_RAM },
  36.     { 0x1000, 0x1fff, videoram_w, &videoram, &videoram_size },
  37.     { 0x2000, 0x20ff, citycon_charlookup_w, &citycon_charlookup },
  38.     { 0x2800, 0x28ff, MWA_RAM, &spriteram, &spriteram_size },
  39.     { 0x3000, 0x3000, citycon_background_w },
  40.     { 0x3001, 0x3001, soundlatch_w },
  41.     { 0x3002, 0x3002, soundlatch2_w },
  42.     { 0x3004, 0x3005, MWA_RAM, &citycon_scroll },
  43.     { 0x3800, 0x3cff, paletteram_RRRRGGGGBBBBxxxx_swap_w, &paletteram },
  44.     { 0x4000, 0xffff, MWA_ROM },
  45.     { -1 }  /* end of table */
  46. };
  47.  
  48. static struct MemoryReadAddress readmem_sound[] =
  49. {
  50.     { 0x0000, 0x0fff, MRA_RAM },
  51. //    { 0x4002, 0x4002, YM2203_read_port_1_r },    /* ?? */
  52.     { 0x6001, 0x6001, YM2203_read_port_0_r },
  53.     { 0x8000, 0xffff, MRA_ROM },
  54.     { -1 }  /* end of table */
  55. };
  56.  
  57. static struct MemoryWriteAddress writemem_sound[] =
  58. {
  59.     { 0x0000, 0x0fff, MWA_RAM },
  60.     { 0x4000, 0x4000, YM2203_control_port_1_w },
  61.     { 0x4001, 0x4001, YM2203_write_port_1_w },
  62.     { 0x6000, 0x6000, YM2203_control_port_0_w },
  63.     { 0x6001, 0x6001, YM2203_write_port_0_w },
  64.     { 0x8000, 0xffff, MWA_ROM },
  65.     { -1 }  /* end of table */
  66. };
  67.  
  68.  
  69.  
  70. INPUT_PORTS_START( citycon )
  71.     PORT_START    /* IN0 */
  72.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  73.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  74.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  75.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  76.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  77.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  78.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  79.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  80.  
  81.     PORT_START
  82.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  83.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  84.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  85.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  86.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  87.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  88.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  89.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  90.  
  91.     PORT_START
  92.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  93.     PORT_DIPSETTING(    0x00, "3" )
  94.     PORT_DIPSETTING(    0x01, "4" )
  95.     PORT_DIPSETTING(    0x02, "5" )
  96.     PORT_BITX( 0,       0x03, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  97.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  98.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  99.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  100.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  101.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  102.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  103.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  104.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  105.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  106.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
  107.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  108.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  109.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  110.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  111.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  112.     /* the coin input must stay low for exactly 2 frames to be consistently recognized. */
  113.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_COIN1, 2 )
  114.  
  115.     PORT_START
  116.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
  117.     PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
  118.     PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
  119.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  120.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  121.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  122.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  123.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  124.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
  125.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  126.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  127.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  128.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  129.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  130.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  131.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  132.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  133.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  134.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  135.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  136.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  137.     PORT_DIPNAME( 0x80, 0x80, "Flip Screen?" )
  138.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  139.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  140. INPUT_PORTS_END
  141.  
  142.  
  143.  
  144. static struct GfxLayout charlayout =
  145. {
  146.     8,8,    /* 8*8 characters */
  147.     256,    /* 256 characters */
  148.     2,    /* 2 bits per pixel */
  149.     { 4, 0 },
  150.     { 0, 1, 2, 3, 256*8*8+0, 256*8*8+1, 256*8*8+2, 256*8*8+3 },
  151.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  152.     8*8    /* every char takes 8 consecutive bytes */
  153. };
  154.  
  155. static struct GfxLayout tilelayout =
  156. {
  157.     8,8,    /* 8*8 characters */
  158.     256,    /* 256 characters */
  159.     4,    /* 4 bits per pixel */
  160.     { 4, 0, 0xc000*8+4, 0xc000*8+0 },
  161.     { 0, 1, 2, 3, 256*8*8+0, 256*8*8+1, 256*8*8+2, 256*8*8+3 },
  162.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  163.     8*8    /* every char takes 8 consecutive bytes */
  164. };
  165.  
  166. static struct GfxLayout spritelayout =
  167. {
  168.     8,16,    /* 8*16 sprites */
  169.     128,    /* 128 sprites */
  170.     4,    /* 4 bits per pixel */
  171.     { 4, 0, 0x2000*8+4, 0x2000*8+0 },
  172.     { 0, 1, 2, 3, 128*16*8+0, 128*16*8+1, 128*16*8+2, 128*16*8+3 },
  173.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  174.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  175.     16*8    /* every sprite takes 16 consecutive bytes */
  176. };
  177.  
  178.  
  179. static struct GfxDecodeInfo gfxdecodeinfo[] =
  180. {
  181.     { REGION_GFX1, 0x00000, &charlayout, 512, 32 },    /* colors 512-639 */
  182.     { REGION_GFX2, 0x00000, &spritelayout, 0, 16 },    /* colors 0-255 */
  183.     { REGION_GFX2, 0x01000, &spritelayout, 0, 16 },
  184.     { REGION_GFX3, 0x00000, &tilelayout, 256, 16 },    /* colors 256-511 */
  185.     { REGION_GFX3, 0x01000, &tilelayout, 256, 16 },
  186.     { REGION_GFX3, 0x02000, &tilelayout, 256, 16 },
  187.     { REGION_GFX3, 0x03000, &tilelayout, 256, 16 },
  188.     { REGION_GFX3, 0x04000, &tilelayout, 256, 16 },
  189.     { REGION_GFX3, 0x05000, &tilelayout, 256, 16 },
  190.     { REGION_GFX3, 0x06000, &tilelayout, 256, 16 },
  191.     { REGION_GFX3, 0x07000, &tilelayout, 256, 16 },
  192.     { REGION_GFX3, 0x08000, &tilelayout, 256, 16 },
  193.     { REGION_GFX3, 0x09000, &tilelayout, 256, 16 },
  194.     { REGION_GFX3, 0x0a000, &tilelayout, 256, 16 },
  195.     { REGION_GFX3, 0x0b000, &tilelayout, 256, 16 },
  196.     { -1 } /* end of array */
  197. };
  198.  
  199.  
  200.  
  201. /* actually there is one AY8910 and one YM2203, but the sound core doesn't */
  202. /* support that so we use 2 YM2203 */
  203. static struct YM2203interface ym2203_interface =
  204. {
  205.     2,            /* 2 chips */
  206.     1250000,    /* 1.25 MHz */
  207.     { YM2203_VOL(20,MIXERG(20,MIXER_GAIN_2x,MIXER_PAN_CENTER)), YM2203_VOL(20,MIXERG(20,MIXER_GAIN_2x,MIXER_PAN_CENTER)) },
  208.     { soundlatch_r },
  209.     { soundlatch2_r },
  210.     { 0 },
  211.     { 0 }
  212. };
  213.  
  214.  
  215.  
  216. static struct MachineDriver machine_driver_citycon =
  217. {
  218.     /* basic machine hardware */
  219.     {
  220.         {
  221.             CPU_M6809,
  222.             2048000,        /* 2.048 Mhz ??? */
  223.             readmem,writemem,0,0,
  224.             interrupt,1
  225.         },
  226.         {
  227.             CPU_M6809 | CPU_AUDIO_CPU,
  228.             640000,        /* 0.640 Mhz ??? */
  229.             readmem_sound,writemem_sound,0,0,
  230.             interrupt,1
  231.         }
  232.     },
  233.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  234.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  235.     0,
  236.  
  237.     /* video hardware */
  238.     32*8, 32*8, { 1*8, 31*8-1, 2*8, 30*8-1 },
  239.     gfxdecodeinfo,
  240.     640, 640,
  241.     0,
  242.  
  243.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  244.     0,
  245.     citycon_vh_start,
  246.     citycon_vh_stop,
  247.     citycon_vh_screenrefresh,
  248.  
  249.     /* sound hardware */
  250.     0,0,0,0,
  251.     {
  252.         {
  253.             SOUND_YM2203,
  254.             &ym2203_interface
  255.         }
  256.     }
  257. };
  258.  
  259.  
  260.  
  261. /***************************************************************************
  262.  
  263.   Game driver(s)
  264.  
  265. ***************************************************************************/
  266.  
  267. ROM_START( citycon )
  268.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  269.     ROM_LOAD( "c10",          0x4000, 0x4000, 0xae88b53c )
  270.     ROM_LOAD( "c11",          0x8000, 0x8000, 0x139eb1aa )
  271.  
  272.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  273.     ROM_LOAD( "c1",           0x8000, 0x8000, 0x1fad7589 )
  274.  
  275.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  276.     ROM_LOAD( "c4",           0x00000, 0x2000, 0xa6b32fc6 )    /* Characters */
  277.  
  278.     ROM_REGION( 0x04000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  279.     ROM_LOAD( "c12",          0x00000, 0x2000, 0x08eaaccd )    /* Sprites    */
  280.     ROM_LOAD( "c13",          0x02000, 0x2000, 0x1819aafb )
  281.  
  282.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  283.     ROM_LOAD( "c9",           0x00000, 0x8000, 0x8aeb47e6 )    /* Background tiles */
  284.     ROM_LOAD( "c8",           0x08000, 0x4000, 0x0d7a1eeb )
  285.     ROM_LOAD( "c6",           0x0c000, 0x8000, 0x2246fe9d )
  286.     ROM_LOAD( "c7",           0x14000, 0x4000, 0xe8b97de9 )
  287.  
  288.     ROM_REGION( 0xe000, REGION_GFX4 )    /* background tilemaps */
  289.     ROM_LOAD( "c2",           0x0000, 0x8000, 0xf2da4f23 )    /* background maps */
  290.     ROM_LOAD( "c3",           0x8000, 0x4000, 0x7ef3ac1b )
  291.     ROM_LOAD( "c5",           0xc000, 0x2000, 0xc03d8b1b )    /* color codes for the background */
  292. ROM_END
  293.  
  294. ROM_START( citycona )
  295.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  296.     ROM_LOAD( "c10",          0x4000, 0x4000, 0xae88b53c )
  297.     ROM_LOAD( "c11b",         0x8000, 0x8000, 0xd64af468 )
  298.  
  299.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  300.     ROM_LOAD( "c1",           0x8000, 0x8000, 0x1fad7589 )
  301.  
  302.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  303.     ROM_LOAD( "c4",           0x00000, 0x2000, 0xa6b32fc6 )    /* Characters */
  304.  
  305.     ROM_REGION( 0x04000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  306.     ROM_LOAD( "c12",          0x00000, 0x2000, 0x08eaaccd )    /* Sprites    */
  307.     ROM_LOAD( "c13",          0x02000, 0x2000, 0x1819aafb )
  308.  
  309.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  310.     ROM_LOAD( "c9",           0x00000, 0x8000, 0x8aeb47e6 )    /* Background tiles */
  311.     ROM_LOAD( "c8",           0x08000, 0x4000, 0x0d7a1eeb )
  312.     ROM_LOAD( "c6",           0x0c000, 0x8000, 0x2246fe9d )
  313.     ROM_LOAD( "c7",           0x14000, 0x4000, 0xe8b97de9 )
  314.  
  315.     ROM_REGION( 0xe000, REGION_GFX4 )    /* background tilemaps */
  316.     ROM_LOAD( "c2",           0x0000, 0x8000, 0xf2da4f23 )    /* background maps */
  317.     ROM_LOAD( "c3",           0x8000, 0x4000, 0x7ef3ac1b )
  318.     ROM_LOAD( "c5",           0xc000, 0x2000, 0xc03d8b1b )    /* color codes for the background */
  319. ROM_END
  320.  
  321. ROM_START( cruisin )
  322.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  323.     ROM_LOAD( "cr10",         0x4000, 0x4000, 0xcc7c52f3 )
  324.     ROM_LOAD( "cr11",         0x8000, 0x8000, 0x5422f276 )
  325.  
  326.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  327.     ROM_LOAD( "c1",           0x8000, 0x8000, 0x1fad7589 )
  328.  
  329.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  330.     ROM_LOAD( "cr4",          0x00000, 0x2000, 0x8cd0308e )    /* Characters */
  331.  
  332.     ROM_REGION( 0x04000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  333.     ROM_LOAD( "c12",          0x00000, 0x2000, 0x08eaaccd )    /* Sprites    */
  334.     ROM_LOAD( "c13",          0x02000, 0x2000, 0x1819aafb )
  335.  
  336.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  337.     ROM_LOAD( "c9",           0x00000, 0x8000, 0x8aeb47e6 )    /* Background tiles */
  338.     ROM_LOAD( "c8",           0x08000, 0x4000, 0x0d7a1eeb )
  339.     ROM_LOAD( "c6",           0x0c000, 0x8000, 0x2246fe9d )
  340.     ROM_LOAD( "c7",           0x14000, 0x4000, 0xe8b97de9 )
  341.  
  342.     ROM_REGION( 0xe000, REGION_GFX4 )    /* background tilemaps */
  343.     ROM_LOAD( "c2",           0x0000, 0x8000, 0xf2da4f23 )    /* background maps */
  344.     ROM_LOAD( "c3",           0x8000, 0x4000, 0x7ef3ac1b )
  345.     ROM_LOAD( "c5",           0xc000, 0x2000, 0xc03d8b1b )    /* color codes for the background */
  346. ROM_END
  347.  
  348.  
  349.  
  350. GAME( 1985, citycon,  0,       citycon, citycon, 0, ROT0, "Jaleco", "City Connection (set 1)" )
  351. GAME( 1985, citycona, citycon, citycon, citycon, 0, ROT0, "Jaleco", "City Connection (set 2)" )
  352. GAME( 1985, cruisin,  citycon, citycon, citycon, 0, ROT0, "Jaleco (Kitkorp license)", "Cruisin" )
  353.